public class Test {
	public static void main(String[] args) {
		byte[] b = new byte[2];
		int off = 0;
		int len = 10;
		long pos = 3;
		long size = 10;
		System.out.println((int)Math.min(Math.min(len, b.length - off), size - pos));
	}
}
